﻿using Newtonsoft.Json.Linq;
using SmartWeighMonitor.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace SmartWeighMonitor.Windows
{
    /// <summary>
    /// InputFreightWindow.xaml 的交互逻辑
    /// </summary>
    public partial class InputQfNumWindow : Window
    {
        string billId = "";
        string carNo = "";
        string material = "";
        public InputQfNumWindow()
        {
            InitializeComponent();
        }
        public void setBill(string billId)
        {
            this.billId = billId;
        }
        public void setCarNo(string carNumber)
        {
            this.carNo = carNumber;
            carNumberText.Text = carNumber;
        }
        public void setMaterial(string materialName)
        {
            this.material = materialName;
            materialNameText.Text = material;
        }

        private void Button_Click_Input(object sender, RoutedEventArgs e)
        {
            if (LeadSealingText.Text==null||LeadSealingText.Text=="")
            {
                MessageBox.Show("请先输入铅封号");
                return;
            }
            //JObject paramJSON = new JObject();
            //paramJSON.Add("id", billId);
            //paramJSON.Add("freightNum", LeadSealingText.Text);
            //paramJSON.Add("clfs","2");
            //String response = HttpPostHelper.doHttpPost("/qd-s-factory/clientApi/tareByGuid", paramJSON.ToString());
            //JObject respJson = JObject.Parse(response);
            //if (!respJson.ContainsKey("success"))
            //{
            //    MessageBox.Show("发生异常");
            //    return;
            //}
            //string status = respJson["success"].ToString();
            //if (status.ToLower() != "true")
            //{
            //    MessageBox.Show(respJson["message"].ToString());
            //    return;
            //}
            this.DialogResult = true;
            this.Content = LeadSealingText.Text;
            this.Close();
        }

    }
}
